#include <iostream>
using std::cout;
using std::endl;

class Complex{
public:
    Complex(double real,double image)
    : _real(real)
    , _image(image)
    {
        cout << "Complex(double,double)" << endl;
    }

    void print() const{
        cout << _real << " + " << _image << "i" << endl;
    }
    
    double real() const{ return _real; }
    double image() const{ return _image; }

private:
    double _real;
    double _image;
};

//运算符重载之普通函数
Complex operator+(const Complex & lhs,const Complex & rhs){
    return Complex(lhs.real() + rhs.real(),
                   lhs.image() + rhs.image());
}

void test0(){
    Complex c1(1,2);
    Complex c2(4,5);
    Complex c3 = c1 + c2;
    c3.print();
}

int main(void){
    test0();
    return 0;
}
